<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="vue/vue.js"></script>
    <title>Document</title>

    <style>
        #app {
            background-color: aquamarine;
            width: 10%;
            height: 100px;
            border-radius: 4px;
        }
        #button{
            background-color: cadetblue;
        }
    </style>
</head>

<body>

    <div id="app" v-on:click="clickDiv">
        {{message}}
        <Button-counter></Button-counter>
    </div>
    <script>
    Vue.component('button-counter', {
        data: function () {
            return {
                count: 0
            }
        },
        template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'
    })

        new Vue({
            el: "#app",
            data: {
                message: "Hello Vue!"
            },
            methods: {
                clickDiv: function () {
                    this.message = "You click Me"
                    self = this
                    setTimeout(() => {
                        self.message = "Hello Vue"
                    }, 1200);
                }
            }
        })
    </script>
</body>

</html>